package com.azdebugit.list.arraylist.test1;

import java.util.Arrays;
import java.util.List;

public class ArraysTest {
    private static void asListTest() {
        String stringArray[] = {"aa", "bb", "cc"};
        List<String> sList = Arrays.asList(stringArray);
        for (String str : sList) {//能遍历出各个元素
            System.out.println(str);
        }
        System.out.println(sList.size());
        System.out.println("- - - - - - - - - - -");
        int intArray[] = {11, 22, 33};
        List intList = Arrays.asList(intArray);
        for (Object o : intList) {//就一个元素
            System.out.println(o.toString());
        }
        System.out.println("- - - - - - - - - - -");
        Integer integerArray[] = {11, 22, 33};
        List<Integer> objList = Arrays.asList(integerArray); //数组里的每一个元素都是作为list中的一个元素
        for (int a : objList) {
            System.out.println(a);
        }
        System.out.println("- - - - - - - - - - -");
    }

    public static void main(String[] args) {
        asListTest();
    }
}